package com.it.web;

import com.it.entity.Verification.AiClaimVerification;
import com.it.service.AiClaimVerificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import utils.R;

import java.util.List;

/**
 * <p>
 * 核赔信息表（对理算结果的审核确认记录） 前端控制器
 * </p>
 *
 * @author yzy
 * @since 2025年09月24日
 */
@RestController
@RequestMapping("/aiClaimVerification")
public class AiClaimVerificationController {

    @Autowired
    private AiClaimVerificationService aiClaimVerificationService;

    // 按报案号和核赔号以及核赔状态模糊查询 + 分页
    @GetMapping("/all")
    public R list(@RequestParam(value = "pageNum",required = false,defaultValue = "1") int pageNum,
                  @RequestParam(value = "pageSize",required = false,defaultValue = "5")int pageSize,
                  @RequestParam(value = "reportNo",required = false)String reportNo,
                  @RequestParam(value = "verificationId",required = false)String verificationId,
                  @RequestParam(value = "verificationStatus",required = false)Integer verificationStatus) {

        return aiClaimVerificationService.list(pageNum,pageSize,reportNo,verificationId,verificationStatus);

    }

    // 根据核赔号查看详情
    @GetMapping("/{verificationId}")
    public R info(@PathVariable("verificationId") String verificationId) {
        return aiClaimVerificationService.info(verificationId);
    }

    // 根据核赔号删除核赔信息
    @DeleteMapping("/{verificationId}")
    public R delete(@PathVariable("verificationId") String verificationId) {
        return aiClaimVerificationService.delete(verificationId);
    }

    // 新增核赔信息
    @PostMapping()
    public R save(@RequestBody AiClaimVerification aiClaimVerification) {
        return aiClaimVerificationService.add(aiClaimVerification);
    }

    // 根据报案号查看详情
    @GetMapping("/report")
    public R selectByReportNo(@RequestParam(value = "reportNo",required = false) String reportNo) {
        return aiClaimVerificationService.selectByreportNo(reportNo);
    }

}
